package com.ahy231.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.JdbcType;

import java.io.Serializable;
import java.sql.Date;
import java.sql.Timestamp;

/**
 * @author ahy231
 * @date 2021/7/26 9:51
 * @description
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("消息")
public class Message implements Serializable {

    private static final long serialVersionUID = -7022920196759325592L;

    @ApiModelProperty("主键")
    @TableId(type = IdType.AUTO)
    private Long messageId;

    @ApiModelProperty("user表发送者id")
    private Long senderId;

    @ApiModelProperty("user表接收者id")
    private Long receiverId;

    @ApiModelProperty("内容")
    private String content;

    @ApiModelProperty("发送时间")
    @TableField(jdbcType = JdbcType.TIMESTAMP)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp time;

    @ApiModelProperty("是否已读（1/未读、2/已读）")
    @TableField("`read`")
    private Integer read;
}
